#include "layout.h"

#include "gui/guimessage.h"

void Layout::Arrange(Widget* parent){
    std::vector<Widget*> children = parent->GetChildren();

    border = 5;
    padding = 5;
    int x = border;
    int y = -border;
//    int height = 0;
//    int width = 0;

    for(Widget* child : children){
        child->Setx(x);
        child->Sety(y);

        if(direction == HORIZONTAL){
            x = x + padding + child->GetWidth();
        }
        else if(direction == VERTICAL){
            y = y - padding - child->GetHeight();
        }
//            if(child->GetHeight() > height){
//                height = child->GetHeight();
//            }
//            if(child->GetWidth() > width){
//                width = child->GetWidth();
//            }
    }
}
